<?php

namespace App\Http\Resources\School;

use Illuminate\Http\Resources\Json\Resource;

/**
 * Class UserRoleResource
 * @package App\Http\Resources\Backend
 * 用户角色
 */
class UserRoleResource extends Resource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'school_id' => $this->school_id,
            'description' => $this->description,
            'is_default' => $this->is_default,
            'can_breakfast' => $this->can_breakfast,
            'breakfast_rate' => $this->breakfast_rate,
            'can_lunch' => $this->can_lunch,
            'lunch_rate' => $this->lunch_rate,
            'can_dinner' => $this->can_dinner,
            'dinner_rate' => $this->dinner_rate,
            'morning_price' => $this->morning_price,
            'lunch_price' => $this->lunch_price,
            'dinner_price' => $this->dinner_price,
            'morning_price_rule' => $this->morning_price_rule,
            'lunch_price_rule' => $this->lunch_price_rule,
            'dinner_price_rule' => $this->dinner_price_rule,
            'created_at' => $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null
        ];
    }
}
